<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="lib/react.development.js"></script>
    <script src="lib/react-dom.development.js"></script>
    <script src="lib/babel.min.js"></script>
    <script src="lib/prop-types.min.js"></script>
</head>
<body>
    <div id="root"></div>
    <script type="text/babel">
     let {Component} = React

    class Tick extends Component{
        constructor(props){
            super(props);
            this.state = {
                username:'',
                age:20
            }
        }
        componentWillMount(){
            console.log('组件挂载前')
        }

        componentDidMount(){
            console.log('组件挂载后')
        }
        componentWillUpdate(){
            console.log('组件更新前')
        }
        componentDidUpdate(){
            console.log('组件更新后')
        }
        componentUnMount(){
            console.log('组件销毁')
        }
        inputCheck = (ev)=>{
            console.log(ev.target.value)
            this.setState({
                [ev.target.name]:ev.target.value
            })
        }

        render(){
            return (<div>
                <input type="text" name="username" value={this.state.username} onChange={this.inputCheck} />
                <input type="checkbox" name="age" value={this.state.age} onChange={this.inputCheck}/>
                
            </div>)
        }
    }

    ReactDOM.render(
        <Tick />,
        document.querySelector('#root')
    )

    </script>
</body>
</html>